<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>Gitee信息</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <c:import url="admin_home.jsp"></c:import>
    <!-- 页面内容 -->
    <div class="layui-body container" style="margin-top: 100px">
     <!-- 搜索框 -->
     	<div class="layui-row" >
     	<form class="layui-form">
     		<div class="layui-form-item">
				<div class="layui-input-inline layui-col-md-offset2 layui-col-md4">
					<input type="text" id="id" name="id" lay-verify="required" placeholder="输入id" autocomplete="off" class="layui-input">
				</div>
				<div class="layui-col-md4">
					<button id="btn_selectTea" type="button" class="btn btn-info">查询</button>
				</div>
			</div>
		</form>
		</div>
	<!-- 显示表格数据 -->
     	<div class="layui-row">
     		<div class="layui-col-md-offset1 layui-col-md10">
     			<table class="table table-hover" id="giteeTable">
     				<thead>
     					<tr>
     						<th>ID</th>
     						<th>创业中心账户</th>
     						<th>Gitee账户</th>
     						<th>Gitee昵称</th>
     						<th>Gitee主页</th>
     						<th>操作</th>
     						<th></th>
     					</tr>
     				</thead>
     				<tbody>
     				</tbody>
     			</table>
     		</div>
     	</div>
	</div>
	<script type="text/javascript">
		//初始化后加载数据
		$(function(){
			layer.load();
			initTable();
			layer.closeAll('loading');
		});
		function initTable(){
			$.get("${pageContext.request.contextPath}/admin/getGiteeInfo.do")
				.done(function(result){
					console.log(result);
					if(result.code==200){
						layer.msg('数据获取失败', {icon: 5});
					}else if(result.code==100){
						var list=result.extend.gitees;
						$.each(list,function(index,giteeVO){
							var id=$("<td></td>").append(index+1);
							var userId=$("<td></td>").append(giteeVO.gitee.userId);
							var userName=$("<td></td>").append(giteeVO.gitee.userName);
							var name=$("<td></td>").append(giteeVO.name);
							var html_url=$("<td></td>").append($("<a></a>").attr("target","_blank").attr("href",giteeVO.html_url).append("访问"));
							$("<tr></tr>").append(id).append(userId)
									.append(userName).append(name).append(html_url).appendTo("#giteeTable tbody")
						});
					}
				});
		}
	</script>
  </body>
</html>
